/*
 * 
 * Libman
 * 
 * Daniel Kaufmann, Martin Lang, Simon Moosbrugger,
 * Stefan Mayer, Stephan Halbeisen
 * 
 */
package start;

import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import application.client.jms.MyConsumer;
import application.controller.client.GuiController;

/**
 * The Class for starting the client.
 */
public class StartClient {

	/**
	 * The main method.
	 * 
	 * @param args
	 *            the arguments
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			GuiController contr = GuiController.getInstance();
			if (args.length != 4) {
				JOptionPane.showMessageDialog(null,
						"Startargumente fehlen! <ip> <port>", "Error",
						JOptionPane.ERROR_MESSAGE);
				System.exit(0);
			} else {
				MyConsumer.setIP(args[2]);
				contr.connectToServer(args[2], args[3]);
			}
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {

			e.printStackTrace();
		}
	}

}
